﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using jbgswin.Resources;

namespace jbgswin
{
    public partial class MainPage : PhoneApplicationPage
    {
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
            if (App.myditu.Count == 0)
            {
                App.myditu.Add(new dituwz()
                {

                    nowid = App.myditu.Count + 1,
                    ly = "29.868038",
                    lx = "121.550331",
                    name = "aagc",
                    shuoming = "aasm",
                });

                App.myditu.Add(new dituwz()
                {

                    nowid = App.myditu.Count + 1,
                    ly = "29.868038",
                    lx = "121.490173",
                    name = "aagc2",
                    shuoming = "aasm2",
                });
                App.myditu.Add(new dituwz()
                {

                   nowid = App.myditu.Count + 1,
                    ly = "29.891066",
                    lx = "121.490173",
                    name = "aagc3",
                    shuoming = "aasm3",
                });
                App.myditu.Add(new dituwz()
                {

                    nowid= App.myditu.Count + 1,
                    ly = "29.891066",
                    lx = "121.550331",
                    name = "aagc3",
                    shuoming = "aasm3",

                });
                // 用于本地化 ApplicationBar 的示例代码
                //BuildLocalizedApplicationBar();
            }
        }

        private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/addpeople.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_1(object sender, RoutedEventArgs e)
        {
            App.mygc.Add(new gcinfo()
            {
                riqi = System.DateTime.Now,
                Id = (App.mygc.Count + 1).ToString(),
                lx = "29.868038",
                ly = "121.550331",
                gcname = "aagc",
                gctext = "aasm",
            });
            App.mygc.Add(new gcinfo()
            {
                riqi = System.DateTime.Now,
                Id = (App.mygc.Count + 1).ToString(),
                lx = "29.868038",
                ly = "121.490173",
                gcname = "aagc2",
                gctext = "aasm2",
            });
            App.mygc.Add(new gcinfo()
            {
                riqi = System.DateTime.Now,
                Id = (App.mygc.Count + 1).ToString(),
                lx = "29.891066",
                ly = "121.490173",
                gcname = "aagc3",
                gctext = "aasm3",
            });
            App.mygc.Add(new gcinfo()
            {
                riqi = System.DateTime.Now,
                Id = (App.mygc.Count + 1).ToString(),
                lx = "29.891066",
                ly = "121.550331",
                gcname = "aagc3",
                gctext = "aasm3",

            });
           
            NavigationService.Navigate(new Uri("/peoplelist.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_2(object sender, RoutedEventArgs e)
        {
           
        }

        private void HyperlinkButton_Click_3(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/downld.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_4(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/upld.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_5(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/localsave.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_6(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/chakan.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_7(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/liuliang.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click_8(object sender, RoutedEventArgs e)
        {
            App.myditu.Clear();
            MessageBox.Show("清空成功");
        }
        // 用于生成本地化 ApplicationBar 的示例代码
        //private void BuildLocalizedApplicationBar()
        //{
        //    // 将页面的 ApplicationBar 设置为 ApplicationBar 的新实例。
        //    ApplicationBar = new ApplicationBar();

        //    // 创建新按钮并将文本值设置为 AppResources 中的本地化字符串。
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);

        //    // 使用 AppResources 中的本地化字符串创建新菜单项。
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}
    }
}